Xbasic

WIN_CREATE_SHORTCUT Function

Syntax

Result_Flag as L = win_create_shortcut(C Shortcut ,C Target [,C Description [,C StartIn [,C IconLocation [,C Arguments ]]]])

Arguments

Result_Flag

Indicates whether the function was able to create the shortcut.

Shortcut

The name and path to the shortcut to be created.

Target

The program to run upon clicking the shortcut.

Description

Optional. Default = "". The comment text for the shortcut.

StartIn

Optional. Default = target's path. The shortcut's "Start In" folder.

IconLocation

Optional. Default = target's path. The path to the icon to be displayed as the shortcut icon.

Arguments

Optional command-line arguments for the shortcut.

Description

The WIN_CREATE_SHORTCUT() function creates a Windows shortcut to the specified location.

Example

dim desktop as C

desktop = win_special_folder("desktop") 
'Create a shortcut to Alpha Anywhere on the desktop 
? win_create_shortcut(desktop + "\Launch Alpha Anywhere", a5.Get_Exe_Path() + "\alpha5.exe") 
= .T. 

'Create the shortcut with a different icon 
? win_create_shortcut(desktop + "\Launch Alpha Anywhere",a5.Get_Exe_Path() + "\alpha5.exe", "Alpha Anywhere is cool", "", "c:\windows\notepad.exe") 
= .T. 

'Create a shortcut to Alphasports 
? win_create_shortcut(desktop + "\Open Alphasports", a5.Get_Exe_Path() + "\alpha5.exe", "Launch the Alphasports sample application", "", "", "\"" + a5.Get_Exe_Path() + "\samples\alphasports\alphasports.adb\"") 
= .T.

See Also